// "Copyright [2021] <Copyright Shengkai Lin>"

// This is a ethernet NIC

package cluster.roce;

import inet.node.base.TransportLayerNodeBase;
import inet.common.MessageDispatcher;
import inet.networklayer.common.InterfaceTable;


module EthernetNicInetSimple extends TransportLayerNodeBase {
    parameters:
        @networkNode;
        @figure[submodules];

        forwarding = default(false);  // disable routing by default
        ipv4.arp.proxyArpInterfaces = default(""); // proxy arp is disabled on hosts by default
        *.routingTableModule = default("^.ipv4.routingTable");
        **.displayAddresses = true;
        **.forwarding = true;
        **.routingTable.netmaskRoutes = "";
        bool hasRoce = default(false);
    gates:
        inout gpu_port;

    submodules:
        at: MessageDispatcher {
            parameters:
                @display("p=750,146;b=1000,5,,,,1");
        }

        roce_adapter : RoceAdapter {
        }
        

    connections allowunconnected:
        gpu_port$i --> roce_adapter.gpu_port$i;
        gpu_port$o <-- roce_adapter.gpu_port$o;

        roce_adapter.socketOut --> at.in++;
        roce_adapter.socketIn <-- at.out++;

        at.out++ --> udp.appIn if hasUdp;
        at.in++ <-- udp.appOut if hasUdp;
        
        at.out++ --> tcp.appIn if hasTcp;
        at.in++ <-- tcp.appOut if hasTcp;

        at.out++ --> tn.in++;
        at.in++ <-- tn.out++;
}